<template>
	<view>
		<view class="wrap">
			<view class="u-tabs-box">
				<u-tabs-swiper activeColor="#1a7ef4" ref="tabs" :list="list" :current="current" @change="change"
					:is-scroll="false" swiperWidth="750"></u-tabs-swiper>
			</view>
			<swiper class="swiper-box" :current="swiperCurrent" @transition="transition"
				@animationfinish="animationfinish">
				<swiper-item class="swiper-item">
					<scroll-view scroll-y style="height: 100%;width: 100%;">
						<view class="page-box">
							<view>
								<u-card v-for="(item, index) in noRegisterList" :key="index" :title="'活动：' + item.activityTitle" title-color="#18b566" :sub-title="item.createDate">
									<view class="" slot="body">
										<view class="u-body-item u-flex u-border-bottom u-col-between u-p-t-0">
											<view class="u-body-item-title">报名人：{{item.creatorName}}</view>
										</view>
										<view class="u-body-item u-flex u-border-bottom u-col-between u-p-t-0" style="margin-top: 30rpx;">
											<u-tag v-if="item.status == 0" text="待审核" mode="dark" type="warning"/>
											<u-tag v-if="item.status == 1" text="审核已通过" mode="dark" type="success"/>
											<u-tag v-if="item.status == 2" text="审核未通过" mode="dark" type="error"/>
										</view>
									</view>
								</u-card>
							</view>
						</view>
					</scroll-view>
				</swiper-item>
				<swiper-item class="swiper-item">
					<scroll-view scroll-y style="height: 100%;width: 100%;">
						<view class="page-box">
							<view>
								<u-card v-for="(item, index) in noRegisterList" :key="index" :title="'活动：' + item.activityTitle" title-color="#18b566" :sub-title="item.createDate">
									<view class="" slot="body">
										<view class="u-body-item u-flex u-border-bottom u-col-between u-p-t-0">
											<view class="u-body-item-title">报名人：{{item.creatorName}}</view>
										</view>
										<view class="u-body-item u-flex u-border-bottom u-col-between u-p-t-0" style="margin-top: 30rpx;">
											<u-tag v-if="item.status == 0" text="待审核" mode="dark" type="warning"/>
											<u-tag v-if="item.status == 1" text="审核已通过" mode="dark" type="success"/>
											<u-tag v-if="item.status == 2" text="审核未通过" mode="dark" type="error"/>
										</view>
									</view>
								</u-card>
							</view>
						</view>
					</scroll-view>
				</swiper-item>
				<swiper-item class="swiper-item">
					<scroll-view scroll-y style="height: 100%;width: 100%;">
						<view class="page-box">
							<view>
								<u-card v-for="(item, index) in noRegisterList" :key="index" :title="'活动：' + item.activityTitle" title-color="#18b566" :sub-title="item.createDate">
									<view class="" slot="body">
										<view class="u-body-item u-flex u-border-bottom u-col-between u-p-t-0">
											<view class="u-body-item-title">报名人：{{item.creatorName}}</view>
										</view>
										<view class="u-body-item u-flex u-border-bottom u-col-between u-p-t-0" style="margin-top: 30rpx;">
											<u-tag v-if="item.status == 0" text="待审核" mode="dark" type="warning"/>
											<u-tag v-if="item.status == 1" text="审核已通过" mode="dark" type="success"/>
											<u-tag v-if="item.status == 2" text="审核未通过" mode="dark" type="error"/>
										</view>
									</view>
								</u-card>
							</view>
						</view>
					</scroll-view>
				</swiper-item>
			</swiper>
		</view>
	</view>
</template>

<script>
	import {
		getActivitySignUpStatus
	} from '@/api/police/reportSituation.js'
	export default {
		data() {
			return {
				list: [{
						name: '待审核'
					},
					{
						name: '审核通过'
					},
					{
						name: '审核不通过'
					}
				],
				current: 0,
				swiperCurrent: 0,
				tabsHeight: 0,
				dx: 0,
				noRegisterList: [],
				yesRegisterList: [],
				haseCasedList: []
			};
		},
		onLoad(){
			console.log(this.swiperCurrent)
			this.getNoRegisterStatus()
		},
		methods: {
			// tab栏切换
			change(index) {
				console.log(index)
				this.swiperCurrent = index;
				if (index == 0) {
					this.getNoRegisterStatus()
				}
				if (index == 1) {
					this.getYesRegisterStatus()
				}
				if (index == 2) {
					this.getHaseCased()
				}
			},
			transition({
				detail: {
					dx
				}
			}) {
				this.$refs.tabs.setDx(dx);
			},
			animationfinish({
				detail: {
					current
				}
			}) {
				this.$refs.tabs.setFinishCurrent(current);
				this.swiperCurrent = current;
				this.current = current;
			},
			// 待审核
			getNoRegisterStatus() {
				getActivitySignUpStatus(0).then(res => {
					if (res.code == 0) {
						this.noRegisterList = res.data
					}
				})
			},
			// 审核通过
			getYesRegisterStatus() {
				getActivitySignUpStatus(1).then(res => {
					if (res.code == 0) {
						this.noRegisterList = res.data
					}
				})
			},
			// 审核不通过
			getHaseCased() {
				getActivitySignUpStatus(2).then(res => {
					if (res.code == 0) {
						this.noRegisterList = res.data
					}
				})
			}
		}
	};
</script>

<style>
	/* #ifndef H5 */
	page {
		height: 100%;
		background-color: #f2f2f2;
	}

	/* #endif */
</style>

<style lang="scss" scoped>
	.order {
		width: 710rpx;
		background-color: #ffffff;
		margin: 20rpx auto;
		border-radius: 20rpx;
		box-sizing: border-box;
		padding: 20rpx;
		font-size: 28rpx;

		.top {
			display: flex;
			justify-content: space-between;

			.left {
				display: flex;
				align-items: center;

				.store {
					margin: 0 10rpx;
					font-size: 32rpx;
					font-weight: bold;
				}
			}

			.right {
				color: $u-type-warning-dark;
			}
		}

		.item {
			display: flex;
			margin: 20rpx 0 0;

			.left {
				margin-right: 20rpx;

				image {
					width: 200rpx;
					height: 200rpx;
					border-radius: 10rpx;
				}
			}

			.content {
				.title {
					font-size: 28rpx;
					line-height: 50rpx;
				}

				.type {
					margin: 10rpx 0;
					font-size: 24rpx;
					color: $u-tips-color;
				}

				.delivery-time {
					color: #1a7ef4;
					font-size: 24rpx;
				}
			}

			.right {
				margin-left: 10rpx;
				padding-top: 20rpx;
				text-align: right;

				.decimal {
					font-size: 24rpx;
					margin-top: 4rpx;
				}

				.number {
					color: $u-tips-color;
					font-size: 24rpx;
				}
			}
		}

		.total {
			margin-top: 20rpx;
			text-align: right;
			font-size: 24rpx;

			.total-price {
				font-size: 32rpx;
			}
		}

		.bottom {
			display: flex;
			margin-top: 40rpx;
			padding: 0 10rpx;
			justify-content: space-between;
			align-items: center;

			.btn {
				line-height: 52rpx;
				width: 160rpx;
				border-radius: 26rpx;
				border: 2rpx solid $u-border-color;
				font-size: 26rpx;
				text-align: center;
				color: $u-type-info-dark;
			}

			.evaluate {
				color: $u-type-warning-dark;
				border-color: $u-type-warning-dark;
			}
		}
	}

	.centre {
		text-align: center;
		margin: 200rpx auto;
		font-size: 32rpx;

		image {
			width: 164rpx;
			height: 164rpx;
			border-radius: 50%;
			margin-bottom: 20rpx;
		}

		.tips {
			font-size: 24rpx;
			color: #999999;
			margin-top: 20rpx;
		}

		.btn {
			margin: 80rpx auto;
			width: 200rpx;
			border-radius: 32rpx;
			line-height: 64rpx;
			color: #ffffff;
			font-size: 26rpx;
			background: linear-gradient(270deg, #1a7ef4 0%, #1a7ef4 100%);
		}
	}

	.wrap {
		display: flex;
		flex-direction: column;
		height: calc(100vh - var(--window-top));
		width: 100%;
	}

	.swiper-box {
		flex: 1;
	}

	.swiper-item {
		height: 100%;
	}
</style>